<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        /* function randomNumber(m, n) {
            return Math.floor(Math.random() * (m - n + 1)) + n
        }

        console.log(randomNumber(99, 0))


        document.write(Math.floor((Math.random() * (10 + 1)))+5) */

        /*  let arr = ['赵云', '黄忠', '关羽', '张飞', '马超','a','b','c','d']
         let mas = Math.floor(Math.random() * arr.length)
         document.write(arr[mas]) */

        /* let arr = ['爱', '很爱', '超级爱', '超级无敌爱', '宇宙超级无敌超级爱']

        let aide = function(){
            let mas = Math.floor(Math.random() * arr.length)
            for(let i = 0 ; i < arr.length;i++){
                if(arr[i]==='宇宙超级无敌超级爱') return arr[i]
            }
        }

        aide() */

        function guessNumder() {
            let mas = Math.floor(Math.random() * 10) + 1
            let count = 3
            for (; ;) {
                let userNum = +prompt('请输入数字')
                count--
                if (userNum > mas) {
                    alert('大了大了')
                    
                } else if (userNum < mas) {
                    alert('小了小了')
                    
                } else {
                    return alert('对了对了')
                }
                if(count===0) return alert('没机会了！哥哥！！')
            }
        }
        guessNumder()

        // function guess() {
        //     let mas = Math.floor(math.random() * 10) + 1


        // }
    </script>
</body>

</html>